<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height">
    <div class="flex-box border-hover-style">
      <div class="Showroom-parent" v-if="props.info.digitalShowroom">
        <digitalShowroomIcon :url="props.info.digitalShowroom" :id="props.info.id" />
      </div>
      <div
        class="outline-parent-bg"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style4/Level3outlineStyle4Bg.webp'})`,
        }"
        :class="{ 'outline-parent-bg2': !props.info.value && !props.info.remarks }"
      >
        <p class="title-name" v-if="props.info.text">{{ props.info.text }}</p>
        <p class="sub-title" v-if="props.info.subTitle">{{ props.info.subTitle }}</p>
        <div
          class="cover"
          :class="{
            cover2: !props.info.subTitle,
            cover3: !props.info.remarks,
          }"
          @click="ImgVisible = true"
          v-if="props.info.value"
        >
          <img class="cover-img" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
        </div>
        <div class="remarks" v-if="props.info.remarks">
          <TextMax
            :data="props.info.remarks"
            :infoData="props.info"
            :title="props.info.text"
            :row="props.info.value ? 4 : 12"
          ></TextMax>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free4style4',
});
</script>
<script lang="ts" setup>
import { publicUrls, textType } from '@/utils/minxin';
import { getTextHtml } from '@/utils/minxin';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { useProjectStore } from '@/store';
import digitalShowroomIcon from '@/freeComponents/unitdigitalShowroom/style4.vue';

const ImgVisible = ref(false);
const store = useProjectStore();

const props = defineProps({
  info: {
    type: Object,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style lang="less" scoped>
.outline-parent {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  margin-right: 140px;
  margin-left: 40px;
}
.flex-box {
  width: 311px;
  height: 684px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.Showroom-parent {
  position: absolute;
  top: 9px;
  right: 18px;
  z-index: 21;
}
.outline-parent-bg2 {
  padding-top: 201px !important;
}
.outline-parent-bg {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 21px;
}
.title-name {
  flex-shrink: 0;
  width: 160px;
  color: #5391a3;
  text-align: center;
  font-family: 'SourceHanSerifCN';
  font-size: 20px;
  font-style: normal;
  font-weight: 700;
  line-height: 28px; /* 116.667% */
}
.sub-title {
  flex-shrink: 0;
  width: 241px;
  color: #333;
  text-align: center;
  font-family: 'PingFang SC';
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 28px; /* 175% */
  margin-top: 10px;
  opacity: 0.8;
}
.cover2 {
  height: 231px !important;
}
.cover3 {
  height: 301px !important;
}
.cover {
  margin-top: 10px;
  width: 241px;
  height: 180px;
  flex-shrink: 0;
  background: #dae6e5;
  overflow: hidden;
  .cover-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.5s;
  }
  &:hover {
    .cover-img {
      transform: scale(1.2);
    }
  }
}
.remarks {
  flex-shrink: 0;
  width: 241px;
  margin-top: 10px;
}
::v-deep .van-text-ellipsis {
  color: rgba(51, 51, 51, 0.8) !important;
  font-family: 'PingFang SC' !important;
  font-size: 16px !important;
  font-style: normal;
  font-weight: 400;
  line-height: 32px; /* 200% */
  opacity: 0.8;
}
::v-deep .van-text-ellipsis__action::before {
  color: #83b0b3 !important;
  font-family: 'PingFang SC' !important;
  font-size: 16px !important;
  font-style: normal;
  font-weight: 500;
  line-height: 32px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
</style>
